﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Xna.Framework;

namespace FontManager
{
    /// <summary>
    /// Class which solo purpose is to provide lines which will be
    ///  represented in GUI using Font or Character properties
    ///  as a parameters for begin and end points.
    /// </summary>
    public class FontLine
    {
        public string Name { get; set; }
        public int X { get; set; }
        public int Y { get; set; }
        public int Width { get; set; }
        public int Height { get; set; }

        //determines if a line is drawed or not
        public bool Visible { get; set; }
        public bool Move { get; set; }
        public Color LineColor { get; set; }
        public bool MouseHover { get; set; }

        public FontLine()
        {
            this.LineColor = Color.Black;
        }

        public FontLine(int X, int Y, int Width, int Height)
        {
            this.X = X;
            this.Y = Y;
            this.Width = Width;
            this.Height = Height;
            this.LineColor = Color.Black;
        }

        /// <summary>
        /// used when want to update values instead of recreating the object
        /// </summary>
        /// <param _name="x">lines starting point</param>
        /// <param _name="y">lines starting point</param>
        /// <param _name="width">how much line goes to the width</param>
        /// <param _name="height">how much line goes to the height</param>
        public void Initialize(float x, float y, float width, float height)
        {
            this.X = (int)x;
            this.Y = (int)y;
            this.Width = (int)width;
            this.Height = (int)height;
        }

        /// <summary>
        /// lines bounding box used in XNA for intersection check
        /// </summary>
        public Rectangle GetSourceRectangle
        {
            get
            {
                return new Rectangle(X, Y, Width, Height);
            }
        }

        public override string ToString()
        {
            return string.Format("[{0}][{1}][{2}][{3}]", X, Y, Width, Height);
        }

    }
}
